package top.jacktgq.concurrent_utils.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import top.jacktgq.utils.LogUtils;

/**
 * 
 * @Title: SingleThreadExecutorDemo.java 
 * @Package top.jacktgq.concurrent_utils.pool 
 * @Description: 测试使用SingleThreadExecutor
 * @author CandyWall   
 * @date 2020年11月4日 下午1:16:16 
 * @version V1.0
 */
public class SingleThreadExecutorDemo {
	public static void main(String[] args) {
		test1();
	}

	private static void test1() {
		ExecutorService threadPool = Executors.newSingleThreadExecutor();
		threadPool.execute(() -> {
			LogUtils.log("SingleThreadExecutorDemo", "1");
			int i = 1 / 0;
		});
		threadPool.execute(() -> {
			LogUtils.log("SingleThreadExecutorDemo", "2");
		});
		threadPool.execute(() -> {
			LogUtils.log("SingleThreadExecutorDemo", "3");
		});
		
	}
}
